﻿using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using LiveCharts;
using WpfTulingGkMes.Models;
using WpfTulingGkMes.Views;

namespace WpfTulingGkMes
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public Func<ChartPoint, string> PointLabel { get; set; }
        public MainWindow()
        {
            var loginView = new UserLoginView();

            if (!loginView.ShowDialog() ?? true)
            {
                return;
            }
        
            InitializeComponent();
            InitLiveChart2();
        }

        private void InitLiveChart2()
        {
            this.DataContext = this;
            PointLabel = chartPoint =>
                string.Format("{0} ({1:P})",
                    chartPoint.Y, chartPoint.Participation);
        }

        private void CanFdScreen(object sender, RoutedEventArgs e)
        {
            if(this.WindowState == WindowState.Normal)
            {
                this.WindowState = WindowState.Maximized;
            }
            else
            {
                this.WindowState = WindowState.Normal;
            }
        }
    }
}